<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        // put your code here
        
        if(isset($_GET["id"])){
            $id=(int)$_GET["id"];
            if($id){
                //要求id必须是数字
                $hostname="127.0.0.1";
                $username="root";
                $password="";
                $database="mybb_text";
                $connect=mysqli_connect($hostname, $username, $password, $database);
                if($connect){
        //            echo "数据库连接成功！";
                    //mysqli_set_charset 设置连接使用的字符集
                    mysqli_set_charset($connect, "utf-8");
                     //mysqli_query 执行sql语句并获得执行结果
                    $sqlstring="delete from user_yi where uid=$id";
                    $result=mysqli_query($connect, $sqlstring);
                    if($result){
                        echo "<script>alert('删除成功！');"
                        . "location='mysql001.php';</script>";
                    }else{
                        echo "删除数据失败！";
                    }
                }
            }else{
               echo "参数错误!"; 
            }
            
        }else{
            echo "参数错误!";
        }
        ?>
    </body>
</html>
